<template>
  <div class="learning-platform">
    <div class="page-header">
      <h1>学习与培训平台</h1>
      <p class="subtitle">提升专业能力，持续学习成长</p>
    </div>

    <div class="content-section">
      <el-row :gutter="24">
        <el-col :span="16">
          <div class="main-content">
            <div class="section-card">
              <h2>课程中心</h2>
              <div class="course-grid">
                <div class="course-card" v-for="course in courses" :key="course.id">
                  <div class="course-image">
                    <i :class="course.icon"></i>
                  </div>
                  <div class="course-content">
                    <h3>{{ course.title }}</h3>
                    <p>{{ course.description }}</p>
                    <div class="course-meta">
                      <span class="duration">{{ course.duration }}</span>
                      <span class="level">{{ course.level }}</span>
                    </div>
                    <el-button type="primary" size="small">开始学习</el-button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </el-col>
        
        <el-col :span="8">
          <div class="sidebar">
            <div class="section-card">
              <h3>学习进度</h3>
              <div class="progress-stats">
                <div class="stat-item">
                  <div class="stat-number">{{ progress.completed }}</div>
                  <div class="stat-label">已完成课程</div>
                </div>
                <div class="stat-item">
                  <div class="stat-number">{{ progress.total }}</div>
                  <div class="stat-label">总课程数</div>
                </div>
                <div class="stat-item">
                  <div class="stat-number">{{ progress.hours }}</div>
                  <div class="stat-label">学习时长(小时)</div>
                </div>
              </div>
            </div>

            <div class="section-card">
              <h3>推荐课程</h3>
              <div class="recommended-courses">
                <div class="recommended-item" v-for="item in recommended" :key="item.id">
                  <h4>{{ item.title }}</h4>
                  <p>{{ item.description }}</p>
                  <el-button type="text" size="small">查看详情</el-button>
                </div>
              </div>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const courses = ref([
  {
    id: 1,
    title: '民事诉讼实务',
    description: '掌握民事诉讼的基本流程和实务技巧',
    duration: '8小时',
    level: '初级',
    icon: 'fas fa-gavel'
  },
  {
    id: 2,
    title: '法律文书写作',
    description: '学习各类法律文书的写作规范和技巧',
    duration: '6小时',
    level: '中级',
    icon: 'fas fa-file-contract'
  },
  {
    id: 3,
    title: '证据收集与运用',
    description: '了解证据收集的方法和法庭运用技巧',
    duration: '10小时',
    level: '高级',
    icon: 'fas fa-search'
  },
  {
    id: 4,
    title: '调解技巧与实务',
    description: '掌握调解的基本技巧和实务操作',
    duration: '4小时',
    level: '中级',
    icon: 'fas fa-handshake'
  }
])

const progress = ref({
  completed: 12,
  total: 25,
  hours: 48
})

const recommended = ref([
  {
    id: 1,
    title: '最新法律法规解读',
    description: '了解最新颁布的法律法规及其影响'
  },
  {
    id: 2,
    title: '典型案例分析',
    description: '通过典型案例学习法律适用'
  }
])
</script>

<style scoped>
.learning-platform {
  padding: 24px;
  background-color: #f5f5f5;
  min-height: 100vh;
}

.page-header {
  text-align: center;
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 16px;
  color: #6b7280;
}

.content-section {
  max-width: 1200px;
  margin: 0 auto;
}

.section-card {
  background: white;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.section-card h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 20px;
}

.section-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 16px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.course-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  background: #fafafa;
  transition: all 0.3s ease;
}

.course-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.course-image {
  text-align: center;
  margin-bottom: 16px;
}

.course-image i {
  font-size: 48px;
  color: #3b82f6;
}

.course-content h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 8px;
}

.course-content p {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 12px;
  line-height: 1.5;
}

.course-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.course-meta span {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #e5e7eb;
  color: #374151;
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: #6b7280;
}

.recommended-courses {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.recommended-item {
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
}

.recommended-item h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 8px;
}

.recommended-item p {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
  line-height: 1.4;
}
</style>

